package xuegao.study.mall.admin.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import xuegao.study.mall.admin.feign.MsClient;
import xuegao.study.mall.common.api.CommonResult;
import xuegao.study.mall.common.ms.SeckillRequest;

/**
 * 商品秒杀,将请求转发至study-web-service
 */
@RestController
@RequestMapping("/ms")
public class MsController {

    @Autowired
    private MsClient msClient;

    //获取秒杀商品列表
    @GetMapping("/api/items")
    public CommonResult getItems() {
        return msClient.getItems();
    }

    //秒杀商品
    @PostMapping("/api/seckill")
    public CommonResult seckill(@RequestBody SeckillRequest request) {
        return msClient.seckill(request);
    }
}
